Page({
    pay() {
        wx.login({
            success: res => {
                let code = res.code;
                wx.request({
                    url: 'http://mppay.0820.cloud/openid.php',
                    method: "GET",
                    data: {
                        code
                    },
                    success: res => {
                        wx.setStorageSync('openid', res.data.openid)

                        wx.request({
                            url: "http://mppay.0820.cloud/jsapi.php",
                            data: {
                                openid: res.data.openid,
                                body: "支付测试",
                                out_trade_no: "122456",
                                total_fee: 1
                            },
                            method: "POST",
                            success: async res => {
                                // console.log(res)
                                let result =await wx.requestPayment({
                                    ...res.data
                                })
                                console.log(result,"111")
                            },
                            fail: err => {
                                console.log(err)
                            }
                        })
                    }
                })

            }
        })
    }
})